<form class="normal_form" form-role="dialog" onsubmit="return Core.DialogForm(this)" style="padding-top:20px;margin-bottom:0;" autocomplete="off">
    <div class="row">
        <div class="field_text">销售：</div>
        <input type="text" name="nickname" value="{$res['nickname'] ?? ''}" class="input-text" style="width:200px;" disabled />
    </div>
    <div class="row">
        <div class="field_text">订单日期：</div>
        <input type="text" name="kday" value="{$res['kday'] ?? ''}" class="input-text" style="width:200px;" disabled />
    </div>    
    <div class="row">
        <div class="field_text">特饮费(元)：</div>
        <input type="text" name="amount" value="{$res['amount'] ?? ''}" class="input-text" style="width:200px;" disabled />
    </div>
    <div class="row">
        <div class="field_text">免支付：</div>
        <div class="labelrow">
            <label class="l-checkbox"><input type="checkbox" name="agree" value="1" /><i></i><span>同意</span></label>
        </div>
    </div>
    <div class="row form-footer-bar">
        <p class="colortip"></p>
        <button class="btn" role="btn-cancel">取消</button>
        <button class="btn btn-primary" type="submit" role="btn-submit" style="background-color:red;border-color:red">特许免支付</button>
    </div>
</form>
<script type="text/javascript">
Core.DialogForm = function(form){    
    var form = $(form);
    var p = {
        'agree'     : 0
    }
    if($(':checkbox[name="agree"]').prop('checked')){
        p['agree'] = 1;
    }
    if (p['agree'] != 1) {
        form.find("p.colortip").html('请先同意免支付!');return false;
    }
    
    form.find(":button").attr('disabled','disabled');
	$.ajax({type : "POST",dataType: "json",cache : false, url : "{$_G['_mca_'] ?? ''}/nkey/{$nkey ?? 'index'}/id/{$res['id'] ?? ''}?r="+Math.random(),data : p,success: function(data){
	   try{
		   if (data['state'] == 'y'){
			   $("#datalist").datagrid('reload');$(form).dialogClose();
		   } else {
			   form.find(":button").removeAttr('disabled');form.find("p.colortip").html(data['msg']);return false;
		   }
	   }catch(e){form.find(":button").removeAttr('disabled');form.find("p.colortip").html('数据提交失败!');return false;}
	}});
	return false;
}
</script>